package com.simulated.communication.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @Author Markburt
 * @Description :搜索用户的前置判断, 通过status判定
 * @DATE: 2020/5/4
 * @TIME: 下午 06:12
 * @YEAR: 2020
 * @Version :
 **/
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum PreSearchFriendsEnum {

    SUCCESS(0,"OK"),
    USER_NOT_FOUND(1,"搜索的用户未找到"),
    USER_CAN_NOT_BE_YOURSELF(2,"不能添加自己为好友"),
    USER_ALREADY_BE_FRIEND(3,"搜索的用户已经是你的好友");

    private Integer status;
    private String msg;

    /**
     * 根据status返回msg
     * @param status
     * @return
     */
    public static String getMsgByStatus(Integer status){
        for (PreSearchFriendsEnum type : PreSearchFriendsEnum.values()) {
            if (type.getStatus().equals(status)) {
                return type.msg;
            }
        }
        return null;
    }
}
